import React,{Component}from "react"
import Register from "./Register"
import Login from "./Login"
import "./index.css"
class Member extends Component{
    constructor(props){
        super(props)
        this.state={
            islogin:3
        }
    }
    componentDidMount(){
       
        if(this.props.match.path!=='/'){
            this.$bus.emit("change",false)
        }
    }
    change_type(type){
        this.setState(state=>{
            state.islogin=type
            return state
        })
    }
    render(){
        let tmp 
        switch (this.state.islogin) {
            // case 1:
            //     tmp=<UserInfo/>
            //     break;
            case 2:
                tmp=<Register change_type={this.change_type.bind(this)}/>
                break;
            case 3:
                tmp=<Login change_type={this.change_type.bind(this)}/>
                break;
        }
        return (
            <div className="Int">  
            <div className="bg">
                <div className="imgs">
                     <img src="./images/M_02.jpg" />
                </div>
            </div>
              {tmp}
            </div>
        )
    }
}
export default Member